#ifndef __ARG_PARSER_H__
#define __ARG_PARSER_H__

#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <string>
#include "vectors.h"
// ====================================================================================

class ArgParser {

public:

  ArgParser() { DefaultValues(); }
  
  ArgParser(int argc, char *argv[]) {
    DefaultValues();

    for (int i = 1; i < argc; i++) 
	{
      if (!strcmp(argv[i],"-input")) 
	  {
		i++; assert (i < argc); 
		input_file = argv[i];
		cloth_file = argv[i];
      } 
	  else if (!strcmp(argv[i],"-size")) 
	  {
		i++; assert (i < argc); 
		width = height = atoi(argv[i]);
      } 
	  else if (!strcmp(argv[i],"-wireframe")) 
	  {
        wireframe = true;
      } 
	  else if (!strcmp(argv[i],"-gouraud")) 
	  {
        gouraud = true;
      } 
	  else if (!strcmp(argv[i],"-timestep")) 
	  {
		i++; assert (i < argc); 
		timestep = atof(argv[i]);
        assert (timestep > 0);
      } 
	  else 
	  {
		printf ("whoops error with command line argument %d: '%s'\n",i,argv[i]);
		assert(0);
      }
    }
  }

  void DefaultValues() {
    input_file = NULL;
    width = 100;
    height = 100;
    wireframe = false;
    gouraud = false;
	
	timestep = 0.01;
    animate = false;

    particles = true;
    velocity = true;
    force = true;

    surface = false;

    wireframe = false;
    bounding_box = true;

    gravity = Vec3f(0,-9.8,0);
  }

  // ==============
  // REPRESENTATION
  // all public! (no accessors)

  char *input_file;
  int width;
  int height;
  bool gouraud;
  
  // ===================================
  // ===================================
  std::string cloth_file;
  std::string fluid_file;

  // animation control
  float timestep;
  bool animate;
  Vec3f gravity;

  // display option toggles 
  // (used by both)
  bool particles;
  bool velocity;
  bool surface;
  bool bounding_box;

  // used by cloth
  bool force;
  bool wireframe; 

};

// ====================================================================================

#endif
